//
//  PerfectContentThreeViewController.m
//  SHHCPhone
//
//  Created by sheng long on 14-6-18.
//  Copyright (c) 2014年 sheng long. All rights reserved.
//

#import "PerfectContentThreeViewController.h"

#import "GuideViewController.h"
#import "GuideRecordViewController.h"

@interface PerfectContentThreeViewController ()

@end

@implementation PerfectContentThreeViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    navigationBarView.title = @"完善资料";
    [navigationBarView setNormalLeftButton];
    
    NSArray *array = @[@[@"完善资料页-有体重秤.png",@"我已经有健康秤"],@[@"完善资料页-无体重秤.png",@"我还没有健康秤"]];
    
    for (int i = 0 ; i < array.count; i++) {
        
        NSArray *aray = [array objectAtIndex:i];
        
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        [button setImage:[UIImage imageNamed:[aray objectAtIndex:0]] forState:UIControlStateNormal];
        [button sizeToFit];
        [button setTag:i];
        [button addTarget:self action:@selector(butt:) forControlEvents:UIControlEventTouchUpInside];
        [self.view addSubview:button];
        [button setCenter:CGPointMake(CURRENT_CONTENT_WIDTH/2-(i==0?8:-8)-(i==0?button.frame.size.width/2:-button.frame.size.width/2), NAVIGATIONBAR_HEIGHT+28+button.frame.size.height/2)];
        
        UILabel *label = [[UILabel alloc] init];
        [label setText:[aray objectAtIndex:1]];
        [label setTextColor:[UIColor whiteColor]];
        [label setBackgroundColor:[UIColor clearColor]];
        [label setFont:[UIFont boldSystemFontOfSize:15]];
        [label sizeToFit];
        [label setCenter:CGPointMake(button.center.x, button.frame.origin.y+button.frame.size.height-10-label.frame.size.height/2)];
        [self.view addSubview:label];
    }
}

-(void)leftButtonClick
{
    [self.navigationController popViewControllerAnimated:YES];
}

-(void)butt:(UIButton*)button
{
    CLog(@"健康秤");
    if (button.tag==0) {
        [self.navigationController pushViewController:[[AppDelegate getAppDelegate] getHomeVC] animated:YES];
    }else{
        if ([APP_USER_MSG.pregnancy integerValue] == 1) {
            [self.navigationController pushViewController:[[GuideViewController alloc] init] animated:YES];
        }else{
            [self.navigationController pushViewController:[[GuideRecordViewController alloc] init] animated:YES];
        }
    }
}

@end
